<template>
  <div class="message">
    <transition-group name="list" tag="div">
      <MessageItem :message="item" :type="item.type" v-for="item in messages" :key="item" />
    </transition-group>
  </div>
</template>
<script setup>
import MessageItem from './MessageItem.vue'

const props = defineProps({
  messages: Array,
})
</script>
<style lang="scss" scoped>
.message {
  flex: 1;
}

.list-enter-active,
.list-leave-active {
  transition: all 0.5s ease;
}
.list-enter-from,
.list-leave-to {
  opacity: 0;
  transform: translateX(-50%);
}
</style>
